﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class show_news : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        show();
        addiulan();
    }

    protected void addiulan()
    {
        int m = (int)Session["m"];
        int c = int.Parse(Request.QueryString["id"]);
        string str1 = "Provider=Microsoft.Jet.OleDb.4.0 ;Data Source=|DataDirectory|\\web.mdb";
        OleDbConnection obj = new OleDbConnection(str1);
        obj.Open();
        string Str1 = "update news set cishu='" + m + "' where id=" + c;
        OleDbCommand cm = new OleDbCommand(Str1, obj);
        cm.ExecuteNonQuery();
        obj.Close();
    }
    protected void show()
    {
        int c = int.Parse(Request.QueryString["id"]);
        string strConnection = "Provider=Microsoft.Jet.OleDb.4.0 ;Data Source=|DataDirectory|\\web.mdb";
        OleDbConnection objConnection = new OleDbConnection(strConnection);
        objConnection.Open();
        string sql = "select * from news where ID=" + c;
        OleDbCommand cmd = new OleDbCommand(sql, objConnection);
        OleDbDataReader reader = cmd.ExecuteReader();
        if (reader.Read())//从数据库读取用户信息
        {
            string q, w, r, y, u, l, k;
            q = reader["timu"].ToString();
            w = reader["time1"].ToString();
            r = reader["bumen"].ToString();
            y = reader["lanmu"].ToString();
            l = reader["name1"].ToString();
            int t = int.Parse(reader["cishu"].ToString());
            k = reader["shenhe"].ToString();
            u = reader["zw"].ToString();
            Label1.Text = q.Trim(); Label2.Text = w.Trim();
            Label3.Text = q.Trim(); Label4.Text = u.Trim();
            Label6.Text = y.Trim();
            t = t + 1;
            Session["m"] = t;
            Label5.Text = t.ToString();
        }
        reader.Close();
        objConnection.Close();
    }
}